home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 September / CHIP 1996 szeptember (CD07).zip / CHIP_CD07.ISO / sac / pack / vblha1.lzh / FRMLHA.FRM < prev    next >
Text File  |  1995-05-09  |  10KB  |  467 lines

  1. VERSION 2.00
  2. Begin Form frmlha 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "LHA file contents"
  5.    Height          =   4440
  6.    Left            =   825
  7.    LinkTopic       =   "Form1"
  8.    ScaleHeight     =   4035
  9.    ScaleWidth      =   3315
  10.    Top             =   1185
  11.    Width           =   3435
  12.    Begin CommandButton cmdVersion 
  13.       Caption         =   "LHA &Version"
  14.       Height          =   495
  15.       Left            =   2040
  16.       TabIndex        =   7
  17.       Top             =   1440
  18.       Width           =   1095
  19.    End
  20.    Begin PictureBox picFile2 
  21.       Height          =   615
  22.       Left            =   3720
  23.       Picture         =   FRMLHA.FRX:0000
  24.       ScaleHeight     =   585
  25.       ScaleWidth      =   465
  26.       TabIndex        =   6
  27.       Top             =   960
  28.       Width           =   495
  29.    End
  30.    Begin PictureBox PicFile1 
  31.       Height          =   615
  32.       Left            =   3720
  33.       Picture         =   FRMLHA.FRX:0302
  34.       ScaleHeight     =   585
  35.       ScaleWidth      =   465
  36.       TabIndex        =   5
  37.       Top             =   240
  38.       Width           =   495
  39.    End
  40.    Begin CommandButton cmdDelete 
  41.       Caption         =   "&Delete"
  42.       Height          =   495
  43.       Left            =   2040
  44.       TabIndex        =   4
  45.       Top             =   3240
  46.       Width           =   1095
  47.    End
  48.    Begin CommandButton cmdExtract 
  49.       Caption         =   "&Extract"
  50.       Height          =   495
  51.       Left            =   2040
  52.       TabIndex        =   3
  53.       Top             =   2040
  54.       Width           =   1095
  55.    End
  56.    Begin CommandButton cmdCancel 
  57.       Cancel          =   -1  'True
  58.       Caption         =   "&Cancel"
  59.       Height          =   495
  60.       Left            =   2040
  61.       TabIndex        =   2
  62.       Top             =   840
  63.       Width           =   1095
  64.    End
  65.    Begin CommandButton cmdOK 
  66.       Caption         =   "&OK"
  67.       Default         =   -1  'True
  68.       Height          =   495
  69.       Left            =   2040
  70.       TabIndex        =   1
  71.       Top             =   240
  72.       Width           =   1095
  73.    End
  74.    Begin ListBox lstLHAcontents 
  75.       FontBold        =   0   'False
  76.       FontItalic      =   0   'False
  77.       FontName        =   "Terminal"
  78.       FontSize        =   9.75
  79.       FontStrikethru  =   0   'False
  80.       FontUnderline   =   0   'False
  81.       Height          =   3540
  82.       Left            =   240
  83.       MultiSelect     =   2  'ègÆú
  84.       TabIndex        =   0
  85.       Top             =   240
  86.       Width           =   1575
  87.    End
  88. End
  89. Sub cmdCancel_Click ()
  90.   
  91. ' set the frmlha.tag to null
  92.   frmLHA.Tag = ""
  93.  
  94. ' hide the frmlha
  95. frmLHA.Hide
  96.  
  97. End Sub
  98.  
  99. 'Copyright 1995 by Hitoshi Ozawa
  100. Sub cmdDelete_Click ()
  101.  
  102. Dim retcode As Integer
  103. Dim curpath As String
  104. Dim cnt
  105. Dim numitem
  106.  
  107. 'Reset buffer size
  108. buffer = Space(szbuff)
  109.  
  110. 'Save current path
  111. curpath = CurDir
  112.  
  113. ChDrive Mid$(frmgetfile.Tag, 1, 2)
  114. ChDir frmgetfile.filFiles.Path
  115.  
  116. numitem = lstLHAcontents.ListCount
  117. cnt = 0
  118. Do While cnt < numitem
  119.  If lstLHAcontents.Selected(cnt) Then
  120.    'Create LHA command
  121.    cmd = "d " & frmgetfile.Tag & " " & lstLHAcontents.List(cnt)
  122.  
  123.    'Perform LHA operation
  124.     retcode = lha(cmd, buffer, szbuff)
  125.  
  126.    'Check for error
  127.    If retcode <> 0 Then
  128.      MsgBox ("Error: " & retcode)
  129.      Exit Sub
  130.    End If
  131.    lstLHAcontents.RemoveItem cnt
  132.    numitem = numitem - 1
  133.  Else
  134.    cnt = cnt + 1
  135.  End If
  136. Loop
  137.  
  138. 'Return to original drive
  139. ChDrive Mid$(curpath, 1, 2)
  140.  
  141. 'Return to original path
  142. ChDir curpath
  143.  
  144. End Sub
  145.  
  146. 'Copyright 1995 by Hitoshi Ozawa
  147. Sub cmdDelete_DragDrop (Source As Control, X As Single, Y As Single)
  148.  
  149. Dim retcode As Integer
  150. Dim curpath As String
  151. Dim cnt
  152. Dim numitem
  153.  
  154. 'Save current path
  155. curpath = CurDir
  156.  
  157. ChDrive Mid$(frmgetfile.Tag, 1, 2)
  158. ChDir frmgetfile.filFiles.Path
  159.  
  160. numitem = lstLHAcontents.ListCount
  161. cnt = 0
  162. Do While cnt < numitem
  163.  If lstLHAcontents.Selected(cnt) Then
  164.    'Create LHA command
  165.    cmd = "d " & frmgetfile.Tag & " " & lstLHAcontents.List(cnt)
  166.  
  167.    'Perform LHA operation
  168.     retcode = lha(cmd, buffer, szbuff)
  169.  
  170.    'Check for error
  171.    If retcode <> 0 Then
  172.      MsgBox ("Error: " & retcode)
  173.      Exit Sub
  174.    End If
  175.    lstLHAcontents.RemoveItem cnt
  176.    numitem = numitem - 1
  177.  Else
  178.    cnt = cnt + 1
  179.  End If
  180. Loop
  181.  
  182. 'Return to original drive
  183. ChDrive Mid$(curpath, 1, 2)
  184.  
  185. 'Return to original path
  186. ChDir curpath
  187.  
  188. End Sub
  189.  
  190. 'Copyright 1995 by Hitoshi Ozawa
  191. Sub cmdDelete_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  192.  
  193. Select Case State
  194.   Case 0
  195.     'change icon to release
  196.      lstLHAcontents.DragIcon = picFile2
  197.   Case 1
  198.     'change icon to release
  199.      lstLHAcontents.DragIcon = picFile1
  200. End Select
  201.  
  202. End Sub
  203.  
  204. 'Copyright 1995 by Hitoshi Ozawa
  205. Sub cmdExtract_Click ()
  206.  
  207. Dim retcode As Integer
  208. Dim curpath As String
  209. Dim cnt
  210.  
  211. 'Reset buffer size
  212. buffer = Space(szbuff)
  213.  
  214. 'Save current path
  215. curpath = CurDir
  216.  
  217. ChDrive Mid$(frmgetfile.Tag, 1, 2)
  218. ChDir frmgetfile.filFiles.Path
  219.  
  220. For cnt = 0 To lstLHAcontents.ListCount - 1
  221.  If lstLHAcontents.Selected(cnt) Then
  222.    'Create LHA command
  223.    cmd = "e " & frmgetfile.Tag & " " & lstLHAcontents.List(cnt)
  224.  
  225.    'Perform LHA operation
  226.     retcode = lha(cmd, buffer, szbuff)
  227.  
  228.    'Check for error
  229.    If retcode <> 0 Then
  230.      MsgBox ("Error: " & retcode)
  231.      Exit Sub
  232.    End If
  233.  End If
  234. Next cnt
  235.  
  236. 'Return to original drive
  237. ChDrive Mid$(curpath, 1, 2)
  238.  
  239. 'Return to original path
  240. ChDir curpath
  241.  
  242. 'refresh getfile file box
  243. frmgetfile.filFiles.Refresh
  244.  
  245. End Sub
  246.  
  247. 'Copyright 1995 by Hitoshi Ozawa
  248. Sub cmdExtract_DragDrop (Source As Control, X As Single, Y As Single)
  249.  
  250. Dim retcode As Integer
  251. Dim curpath As String
  252. Dim cnt
  253.  
  254. 'Save current path
  255. curpath = CurDir
  256.  
  257. ChDrive Mid$(frmgetfile.Tag, 1, 2)
  258. ChDir frmgetfile.filFiles.Path
  259.  
  260. For cnt = 0 To lstLHAcontents.ListCount - 1
  261.  If lstLHAcontents.Selected(cnt) Then
  262.    'Create LHA command
  263.    cmd = "e " & frmgetfile.Tag & " " & lstLHAcontents.List(cnt)
  264.  
  265.    'Perform LHA operation
  266.     retcode = lha(cmd, buffer, szbuff)
  267.  
  268.    'Check for error
  269.    If retcode <> 0 Then
  270.      MsgBox ("Error: " & retcode)
  271.      Exit Sub
  272.    End If
  273.  End If
  274. Next cnt
  275.  
  276. 'Return to original drive
  277. ChDrive Mid$(curpath, 1, 2)
  278.  
  279. 'Return to original path
  280. ChDir curpath
  281.  
  282. 'refresh getfile file box
  283. frmgetfile.filFiles.Refresh
  284.  
  285. End Sub
  286.  
  287. 'Copyright 1995 by Hitoshi Ozawa
  288. Sub cmdExtract_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  289.  
  290. Select Case State
  291.   Case 0
  292.     'change icon to release
  293.      lstLHAcontents.DragIcon = picFile2
  294.   Case 1
  295.     'change icon to release
  296.      lstLHAcontents.DragIcon = picFile1
  297. End Select
  298.  
  299. End Sub
  300.  
  301. 'Copyright 1995 by Hitoshi Ozawa
  302. Sub cmdOK_Click ()
  303.  
  304. Dim retcode As Integer
  305. Dim curpath As String
  306.  
  307. 'Check if file selected
  308. If lstLHAcontents.Text = "" Then
  309.   frmLHA.Tag = ""
  310.   frmLHA.Hide
  311. End If
  312.  
  313. 'Save current path
  314. curpath = CurDir
  315.  
  316. 'Change to file's drive and path
  317. ChDrive Mid$(frmgetfile.Tag, 1, 2)
  318. ChDir frmgetfile.filFiles.Path
  319.  
  320. 'Check if file already exists
  321. On Error GoTo ExtFile
  322.  retcode = GetAttr(lstLHAcontents.Text)
  323.  retcode = MsgBox("Overwrite existing file?", 308, "File already exists!")
  324. If retcode = 6 Then
  325.    Kill lstLHAcontents.Text
  326.    GoTo ExtFile
  327.  End If
  328. Exit Sub
  329.  
  330. ExtFile:
  331. 'Create LHA command
  332. cmd = "e " & frmgetfile.Tag & " " & lstLHAcontents.Text
  333.  
  334. 'Perform LHA operation
  335. retcode = lha(cmd, buffer, szbuff)
  336.  
  337. 'Check for error
  338. If retcode <> 0 Then
  339.  MsgBox ("LHA.DLL Error: " & retcode)
  340.  Exit Sub
  341. End If
  342.  
  343. 'Return to original drive
  344. ChDrive Mid$(curpath, 1, 2)
  345.  
  346. 'Return to original path
  347. ChDir curpath
  348.  
  349. 'refresh getfile file box
  350. frmgetfile.filFiles.Refresh
  351.  
  352. 'Assign selection to tag
  353. frmLHA.Tag = lstLHAcontents.Text
  354.  
  355. frmLHA.Hide
  356.  
  357. Exit Sub
  358. End Sub
  359.  
  360. Sub cmdtop_Click ()
  361.  
  362. '        If VisibleFrame Is Nothing Then
  363. '            frmCallDlls!fraInfo(0).Visible = False
  364. '        Else
  365. '            VisibleFrame.Visible = False
  366. '        End If
  367. '        frmCallDlls!fraInfo(Index + 1).Visible = True
  368. '        Set VisibleFrame = frmCallDlls!fraInfo(Index + 1)
  369. '    Else
  370. '        mnuSysInfo(Index).Checked = Not mnuSysInfo(Index).Checked
  371. '        If mnuSysInfo(Index).Checked Then
  372. '            SetWindowPos frmCallDlls.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW
  373. '        Else
  374. '            SetWindowPos frmCallDlls.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW
  375. '        End If
  376.  
  377.  
  378. End Sub
  379.  
  380. Sub cmdVersion_Click ()
  381.  
  382. Dim retcode As Integer
  383.  
  384. 'Perform LHA operation
  385. retcode = LhaGetVersion()
  386.  
  387. retcode = MsgBox("Current Version: " & retcode, 0, "LHA.DLL Information")
  388.  
  389. End Sub
  390.  
  391. 'Copyright 1995 by Hitoshi Ozawa
  392. Sub Form_Activate ()
  393.  
  394. Dim cnt As Integer
  395. Dim retcode As Integer
  396. Dim stptr
  397. Dim endptr
  398.  
  399. 'Reset buffer size
  400. buffer = Space(szbuff)
  401.  
  402. 'Clear list box
  403. lstLHAcontents.Clear
  404. frmLHA.Refresh
  405.  
  406. 'Create LHA command
  407. cmd = "l " & frmgetfile.Tag
  408.  
  409. 'Perform LHA operation
  410. retcode = lha(cmd, buffer, szbuff)
  411.  
  412. 'Check for error
  413. If retcode <> 0 Then
  414.  MsgBox ("Error: " & retcode)
  415.  Exit Sub
  416. End If
  417.  
  418. 'Skip past header
  419. endptr = InStr(buffer, "-")
  420. stptr = InStr(endptr, buffer, Chr(10))
  421.  
  422. Do While Mid$(buffer, stptr, 1) <> "-"
  423. 'Skip past chr(10)
  424.   stptr = InStr(stptr, buffer, " ")
  425.  
  426. 'Skip past spaces
  427.   stptr = 13 - Len(LTrim$(Mid$(buffer, stptr, 13))) + stptr
  428.  
  429. 'Find end of file name
  430.   endptr = InStr(stptr, buffer, " ")
  431.  
  432. 'Add filename to list
  433.   lstLHAcontents.AddItem Trim(Mid$(buffer, stptr, endptr - stptr))
  434.  
  435. 'Skip to end of row
  436.   stptr = InStr(stptr, buffer, Chr(10)) + 1
  437.  
  438. 'Check for going past end of buffer
  439.   If stptr >= szbuff Then
  440.     Exit Do
  441.   End If
  442. Loop
  443.  
  444. lstLHAcontents.Refresh
  445.  
  446. End Sub
  447.  
  448. 'Copyright 1995 by Hitoshi Ozawa
  449. Sub lstLHAcontents_DblClick ()
  450.  
  451. 'Execute the cmdOK_Click() procedure and close frmlha
  452. cmdOK_Click
  453.  
  454. End Sub
  455.  
  456. 'Copyright 1995 by Hitoshi Ozawa
  457. Sub lstLHAcontents_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  458.  
  459. 'Change drag icon
  460. lstLHAcontents.DragIcon = picFile1
  461.  
  462. 'Enable drag
  463. lstLHAcontents.Drag
  464.  
  465. End Sub
  466.  
  467.